package org.example.dao.comment;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.entity.Comment;

import java.util.List;

@Mapper
public interface CommentMapper {

    @Insert("insert into comment( open_id, goods_id, comment_text,create_time) " +
            "values (#{openId},#{goodsId},#{commentText},#{createTime})")
    boolean addComment(Comment comment);

    @Delete("delete from comment where comment_id = #{commentId}")
    boolean deleteComment(Integer commentId);


    @Select("select * from comment where open_id =#{openId}")
    List<Comment> getUsersComment(String openId);

    @Select("select * from comment where goods_id = #{goodsId}")
    List<Comment> getGoodsComment(Integer goodsId);

    List<Comment> listByReason(String commentIdBegin, String commentIdEnd, String commentText, String goodsId, String beginTime, String endTime);
}
